<template>
  <div class="home">
    <!-- <h2>Home页面的数据:{{$store.getters.getNum}}</h2> -->
    <!-- <h2>Home页面的数据:{{$store.state.num}}</h2> -->
    <h2>Home页面的数据:{{num}}</h2>
    <li>{{$store.state}}</li>
    <li>{{$store.state.users.nickName}}</li>
    <button @click="changeNickName()">将大圣改为老猪</button>
  </div>
</template>
<script>
// 映射
import { mapState, mapMutations } from 'vuex'
export default {
  name:'Home',
  computed:{
    ...mapState(['num'])
  },
  methods: {
    ...mapMutations({
      // changeNickName属于users下面的方法
      'changeNickName':'users/changeNickName'
    })
  }
}
</script>